{extend name="base"}
{block name="title"}后台管理-用户管理{/block}
{block name="main-title"}userlist{/block}
{block name="main"}
<div class="widget-header">
  <i class="icon-group"></i>
  <h5>用户</h5>
  <div class="widget-buttons">
    <a href="#" data-title="Add Employee" data-toggle="modal" data-target="#example_modal"><i class="icon-plus"></i></a>
    <a href="#" data-title="Collapse" data-collapsed="false" class="collapse"><i class="icon-chevron-up"></i></a>
  </div>

  <!-- 添加用户 -->
  <div id="example_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h3 id="myModalLabel">添加用户</h3>
    </div>
    <form class="form-horizontal" action="{:url('doadduser')}">
      <div class="modal-body">

        <div class="control-group">
          <label class="control-label">姓名</label>
          <div class="controls">
            <input class="span7" type="text" name="realname">
          </div>
        </div>

        <div class="control-group">
          <label class="control-label">密码</label>
          <div class="controls">
            <input class="span7" type="password" name="pw">
          </div>
        </div>

        <div class="control-group">
          <label class="control-label">电话</label>
          <div class="controls">
            <input class="span7" type="text" name="tele">
          </div>
        </div>

        <div class="control-group">
          <label class="control-label">邮箱</label>
          <div class="controls">
            <input class="span7" type="email" name="mail">
          </div>
        </div>

        <div class="control-group">
          <label class="control-label">部门</label>
            <div class="controls">
              <select class="span7" tabindex="1" name="rid">
                {volist name="roles" id="vo"}
                <option value="{$vo.rid}">{$vo.rolename}</option>
                {/volist}
              </select>
           </div>
        </div>

      </div> 
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
        <button class="btn btn-primary">添加</button>
      </div>
    </form> 
  </div>

</div>
<div class="widget-body">
  <table id="users" class="table table-striped table-bordered dataTable">
    <thead>
      <tr>
        <th>姓名</th>
        <th>电话</th>
        <th>邮箱</th>
        <th>所属部门</th>
        <th>状态</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      {volist name="usersa" id="vo"}
      <tr>
          <td>{$vo.realname}</td>
          <td>{$vo.tele}</td>
          <td>{$vo.mail}</td>
          <td>{$vo.rolename}</td>
          <td>
              {if condition="$vo.status == 0"}<span class="label label-success">正常</span>
              {else/}<span class="label">禁用</span>
              {/if}
          </td>
          <td>
            <div class="btn-group">
              <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
              Action
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu pull-right">
                <li><a href="#"><i class="icon-wrench"></i> 重置密码</a></li>
                <li><a href="{:url('edituser',['uid'=>$vo.uid])}"><i class="icon-edit"></i> 修改</a></li>
                <li><a href="{:url('deluser',['uid'=>$vo.uid])}"><i class="icon-trash"></i> 删除</a></li>
              </ul>
            </div>
          </td>
      </tr>
      {/volist}
    </tbody>
  </table>
</div> <!-- /widget-body -->
{/block}